import {Component, OnInit, ViewChild} from '@angular/core';
import {SFSchema} from 'nz-schema-form';
import {SimpleTableColumn, SimpleTableComponent} from '@delon/abc';
import {UserService} from '../user.service';
import {NzModalService} from 'ng-zorro-antd';
import {EditpwdComponent} from './editpwd/editpwd.component';

@Component({
    selector: 'app-list',
    templateUrl: './list.component.html',
})
export class ListComponent implements OnInit {
    total = 0;
    pagesize = 10;
    pageCureent = 1;
    data: any[] = [];

    constructor(private userService: UserService,
                private modalService: NzModalService) {
    }

    ngOnInit() {
        this.getlist(1);
    }


    getlist($event) {
        this.userService.getuserlist($event - 1).subscribe((res) => {
            this.data = res['list'];
            this.total = res['totalElement'];
            this.pagesize = res['pageSize'];
            this.pageCureent = $event;
        });
    }

    showModal(id) {
        const subscription = this.modalService.open({
            title: '修改用户密码',
            content: EditpwdComponent,
            onOk() {
            },
            onCancel() {
            },
            footer: false,
            componentParams: {
                id: id
            }
        });
    }

}
